//
//  BN_NurserySchoolViewController.m
//  BabyNow
//
//  Created by 刘泽琛 on 14-3-28.
//  Copyright (c) 2014年 iMobile. All rights reserved.
//

#import "BN_NurserySchoolViewController.h"
#import "BN_SchoolIntroductionViewController.h"
#import "BN_SchoolActivityViewController.h"
#import "BN_WeekRecipeViewController.h"
#import "BN_SuggestionBoxViewController.h"

@interface BN_NurserySchoolViewController () {
    // imageView数组
    NSArray *buttonArr_;
}

@end

@implementation BN_NurserySchoolViewController

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSUserDefaults *userD = [NSUserDefaults standardUserDefaults];
    [userD setInteger:10 forKey:USERDEFAULTS_CLASSPARENT];
    [userD setInteger:10 forKey:USERDEFAULTS_DYNAMICORNOTICE];
    [userD synchronize];
    
    // UI
    self.tabBarController.tabBar.hidden = NO;
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
    self.navigationController.navigationBarHidden = NO;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    switch (MAIN_VERSION) {
        case 6:
        {
            self.schoolIntroductionImageView.frame = CGRectMake(CGRectGetMinX(self.schoolIntroductionImageView.frame), CGRectGetMinY(self.schoolIntroductionImageView.frame)-64, 97, 97);
            self.jianjieLabel.frame = CGRectMake(CGRectGetMinX(self.jianjieLabel.frame), CGRectGetMinY(self.jianjieLabel.frame)-64, 97, 21);
            
            self.schoolActivityImageView.frame = CGRectMake(CGRectGetMinX(self.schoolActivityImageView.frame), CGRectGetMinY(self.schoolActivityImageView.frame)-64, 97, 97);
            self.huodongLabel.frame = CGRectMake(CGRectGetMinX(self.huodongLabel.frame), CGRectGetMinY(self.huodongLabel.frame)-64, 97, 21);

            
            self.weekRecipeImageView.frame = CGRectMake(CGRectGetMinX(self.weekRecipeImageView.frame), CGRectGetMinY(self.weekRecipeImageView.frame)-64, 97, 97);
            self.foodLabel.frame = CGRectMake(CGRectGetMinX(self.foodLabel.frame), CGRectGetMinY(self.foodLabel.frame)-64, 97, 21);

            
            self.suggestionBoxImageView.frame = CGRectMake(CGRectGetMinX(self.suggestionBoxImageView.frame), CGRectGetMinY(self.suggestionBoxImageView.frame)-64, 97, 97);
            self.yijianLabel.frame = CGRectMake(CGRectGetMinX(self.yijianLabel.frame), CGRectGetMinY(self.yijianLabel.frame)-64, 97, 21);

            
        }
            break;
        default:
            break;
    }
    
    
    
    self.schoolActivityImageView.userInteractionEnabled = YES;
    self.schoolIntroductionImageView.userInteractionEnabled = YES;
    self.weekRecipeImageView.userInteractionEnabled = YES;
    self.suggestionBoxImageView.userInteractionEnabled = YES;
    
    buttonArr_ = [[NSArray alloc]init];
    
    buttonArr_ = @[self.schoolIntroductionImageView,self.schoolActivityImageView,self.weekRecipeImageView,self.suggestionBoxImageView];
    
    UITapGestureRecognizer *schoolIntroductionTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(schoolIntroductionAction:)];
    [self.schoolIntroductionImageView addGestureRecognizer:schoolIntroductionTap];
    
    UITapGestureRecognizer *schoolActivityTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(schoolActivityAction:)];
    [self.schoolActivityImageView addGestureRecognizer:schoolActivityTap];
    
    UITapGestureRecognizer *weekRecipeTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(weekRecipeAction:)];
    [self.weekRecipeImageView addGestureRecognizer:weekRecipeTap];
    
    UITapGestureRecognizer *suggestionBoxTap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(suggestionBoxAction:)];
    [self.suggestionBoxImageView addGestureRecognizer:suggestionBoxTap];
}

- (void)schoolIntroductionAction:(UITapGestureRecognizer *)tap {

    BN_SchoolIntroductionViewController *schoolIntroductionVC_ = [[BN_SchoolIntroductionViewController alloc]init];
    [self.navigationController pushViewController:schoolIntroductionVC_ animated:YES];
}

- (void)schoolActivityAction:(UITapGestureRecognizer *)tap {
    BN_SchoolActivityViewController *schoolActivityVC_ = [[BN_SchoolActivityViewController alloc]init];
    [self.navigationController pushViewController:schoolActivityVC_ animated:YES];
}

- (void)weekRecipeAction:(UITapGestureRecognizer *)tap {
     BN_WeekRecipeViewController *weekRecipeVC_ = [[BN_WeekRecipeViewController alloc]init];
    [self.navigationController pushViewController:weekRecipeVC_ animated:YES];
}

- (void)suggestionBoxAction:(UITapGestureRecognizer *)tap {

     BN_SuggestionBoxViewController *suggestionBoxVC_ = [[BN_SuggestionBoxViewController alloc]init];
    [self.navigationController pushViewController:suggestionBoxVC_ animated:YES];
}

#pragma mark 
#pragma mark 资源
- (void)dealloc
{
    // code...
}

@end
